package com.sxy;

import com.sxy.dao.BookDao;
import com.sxy.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author 宋鑫宇
 * @version 1.0
 */
public class App3 {
    public static void main(String[] args) {
        //3.获取ioc容器
        ClassPathXmlApplicationContext c = new ClassPathXmlApplicationContext("applicationContext.xml");

        //4.获取bean
//        BookDao bookDao = (BookDao) c.getBean("bookDao");
//
//        bookDao.save();
        //bean的生命周期
        BookDao bookDao = (BookDao) c.getBean("bookDao");
        bookDao.save();
        c.registerShutdownHook();
        //close关闭比较暴力
//        c.close();
    }
}
